import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);

const Index = resolve => require(['../pages/index.vue'], resolve);
const Mobile_detail = r => require.ensure([], () => r(require('../pages/view.vue')), 'detail');
const routes = [
    { path: '/', component: Index},
    { path: '/:uuid',name:"detail",component: Mobile_detail},
]

const router = new VueRouter({
    mode: 'history',  
    routes,
    scrollBehavior (to, from, savedPosition) {
		if (savedPosition) {
		    return savedPosition
		} else {
		    return { x: 0, y: 0 }
		}
	}
})

export default router;
